package com.xln.furns.utils;

import org.apache.commons.beanutils.BeanUtils;

import java.lang.reflect.InvocationTargetException;
import java.util.Map;

public class DateUtils {

    public static <T> T copyParamToBean(Map value, T bean) {

        try {
            BeanUtils.populate(bean, value);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        }
        return bean;
    }
    public static int parseInt(String val,int defaultval){
        try {
            return Integer.parseInt(val);
        }catch (NumberFormatException e){
            e.printStackTrace();
        }
        return defaultval;
    }
}
